﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <tool/_def.h>
#include "tool/crc32.h"
#include "tool/tcpclient.h"
#include "tool/logwidget.h"
#include <QMap>
#include <QTimer>
#include "tool/jsonprase.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_actionCRC32_triggered();

    void on_pushButton_clicked();


   void onMessageReceived(const QString &message);

   void onConnected();
   void onDisconnected();
   void on_actionLOG_triggered();

   void on_actionimport_json_triggered();
   void timerSendTimeout();
private:
    Ui::MainWindow *ui;
    crc32 *crc32Tool=nullptr;

    QThread *clientThread=nullptr;
    TcpClient *tcpClient=nullptr;

    logWidget *log=nullptr;

    QTimer timerSend;
    int timerSendIndex=0;
    JsonData jsondata;
};
#endif // MAINWINDOW_H
